public class old_neq {
    public static int snippet(int num, int den) {
        int ratio;
        if (num < 0 || den < 0) {
            ratio = -1;
        } else if (den == 0 || num == 0) {
            ratio = 0;
        } else if (den > 200 || num > 200) {
            ratio = 200;
        } else if (den < 2) {
            ratio = 2 * num;
        } else if (den < 4) {
            ratio = num - den;
        } else if (den < 8) {
            if (num < den) {
                ratio = num;
            } else {
                ratio = den;
            }
        } else if (den < 16) {
            if (num > den) {
                ratio = num;
            } else {
                ratio = den;
            }
        } else if (den < 32) {
            ratio = 32;
            for (int i = 2; i < 32; i++) {
                if (num % i == 0) {
                    ratio = i;
                    break;
                }
            }
        } else if (den < 64) {
            ratio = 64;
            for (int i = 2; i < 64; i++) {
                if (den % i == 0) {
                    ratio = i;
                    break;
                }
            }
        } else if (den < 128) {
            int x = den, y = num, z = x + y;
            for (int i = 1; i < 30; i++) {
                
                    z = x + y;
                    x = y;
                    y = z;
                
            }
            ratio=z;
            ratio=ratio+num;
        } else {
            ratio=0;
            for (int i = 0; i < num; i++) {
                ratio = ratio + 2 * i;
            }
            for (int j = 0; j < den; j++) {
                ratio = ratio + 3 * j;
            }
            ratio = ratio + num + den + 10;
            if (false) {
                return ratio * 10;
            }
            ratio = ratio * 10;
        }
        return ratio;
    }
}
